package com.budwk.app.sqfwV2.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum EducationalInstitutionEnums {
    A(1,"幼儿园","sqfwV2/educationalInstitution/yey.docx","观山湖区镇（街道）无证幼儿园统计表","sqfwV2/educationalInstitution/templet/观山湖区镇无证幼儿园统计表.docx"),
    B(2,"培训机构","sqfwV2/educationalInstitution/pxjg.docx","观山湖区校外培训机构摸排表","sqfwV2/educationalInstitution/templet/观山湖区校外培训机构摸排表.docx"),
    C(3,"幼儿园","sqfwV2/educationalInstitution/yey.xlsx","观山湖区镇（街道）无证幼儿园统计表台账","sqfwV2/educationalInstitution/templet/观山湖区镇（街道）无证幼儿园统计表台账.xlsx"),
    D(4,"培训机构","sqfwV2/educationalInstitution/pxjg.xlsx","观山湖区校外培训机构摸排表台账","sqfwV2/educationalInstitution/templet/观山湖区校外培训机构摸排表台账.xlsx"),
    ;
    private  int code;
    private  String name;
    private  String templat;
    private  String fileName;
    private  String blankTemplate;



    public static String getFileName(String name){
        String filename = Arrays.asList(EducationalInstitutionEnums.values())
                .stream()
                .filter(e -> name .equals(e.getName())&&e.getCode()<=2 )
                .collect(Collectors.toList())
                .get(0)
                .getFileName();
        return filename;
    }

    public static String getBlankTemplate(Integer code){
        String blankTemplate = Arrays.asList(EducationalInstitutionEnums.values())
                .stream()
                .filter(e -> code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getBlankTemplate();
        return blankTemplate;
    }
    public static String getName(Integer code){
        String name = Arrays.asList(EducationalInstitutionEnums.values())
                .stream()
                .filter(e -> code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getName();
        return name;
    }

    public static String getPdfTemplatName(String name){
        String templat = Arrays.asList(EducationalInstitutionEnums.values())
                .stream()
                .filter(e -> name .equals(e.getName()) )
                .collect(Collectors.toList())
                .get(0)
                .getTemplat();
        return templat;
    }

    public static String getPdfTemplat(Integer code){
        String templat = Arrays.asList(EducationalInstitutionEnums.values())
                .stream()
                .filter(e ->  code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getTemplat();
        return templat;
    }
    public static String getFileName(Integer code){
        String fileName = Arrays.asList(EducationalInstitutionEnums.values())
                .stream()
                .filter(e -> code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getFileName();
        return fileName;
    }

}
